Option Strict Off
Option Explicit On

Imports BCS.MotorActivacion.Base

Public Class Servicios
    Inherits Lista

    Public ReadOnly Property Item() As Servicio
        Get
            Return m_Item
        End Get
    End Property

    Public Sub AddItem(ByVal NewVal As Servicio, Optional ByVal Refresh As Boolean = True)
        If Not m_List.Contains(NewVal.Key) Then
            m_List.Add(NewVal)
            If Refresh = True Then
                toRefresh()
            End If
        Else
            m_List.Item(NewVal.Key) = NewVal
        End If
    End Sub

    Public Function GetItem(ByVal Key As String) As Servicio
        If m_List.Contains(Key) Then
            GetItem = m_List.Item(Key)
        Else
            GetItem = New Servicio
        End If
    End Function

    Public Function GetItem(ByVal Key As Integer) As Servicio
        Dim Retorno As Servicio = New Servicio

        Try
            If Not m_List(Key) Is Nothing Then
                Retorno = m_List.Item(Key)
            End If
        Catch ex As Exception

        End Try

        Return Retorno
    End Function

    Public Function Clonar() As Servicios
        Dim newServicios As Servicios
        Dim newServicio As Servicio
        Dim auxServicio As Servicio
        Dim i As Short

        newServicios = New Servicios

        For i = 0 To i <= m_List.Count
            auxServicio = m_List.Item(m_List(i))
            newServicio = auxServicio.Clonar
            newServicios.AddItem(newServicio)
        Next

        Return newServicios
    End Function

    Public Sub New()
        MyBase.New()
    End Sub

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub
End Class